package com.bjpowernode.threadpool.usage;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class SimpleThreadPool {

    //基于Executor框架实现线程池
    private ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(
            8,
            16,
            15,
            TimeUnit.SECONDS,
            new ArrayBlockingQueue<Runnable>(100),
            new ThreadPoolExecutor.CallerRunsPolicy());

    /**
     * getter 方法，返回线程池对象
     *
     * @return
     */
    public ThreadPoolExecutor getThreadPoolExecutor() {
        return threadPoolExecutor;
    }
}
